<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
    <style>
        body{
            display: flex;
            justify-content: center;
        }
        div{
            margin-top: 100px;
        }
        span{
            font-size: 30px;
            color: crimson;
        }
    </style>
</head>
<body>
    <div>
        <h2>恭喜您支付成功</h2>
        <span id="jumpTo">10</span> 秒后返回首页
        <p><button>立即返回</button></p>
    </div>
    <script>
        window.onload = function(){
            let timer = 10;
            setInterval(function(){
                timer--;
                document.getElementById('jumpTo').innerHTML=timer
                if(timer==0){
                    location.href='https://www.baidu.com'
                }
            },1000)
            document.getElementsByTagName('button')[0].addEventListener('click',function(){
                location.href='https://www.baidu.com'
            })
        }
    </script>
</body>
</html>